package com.lapian.designmode.observer.improve.test.improveE;

import java.util.ArrayList;
import java.util.List;

public class WeatherDateC {
    List<ObserverC> list;
    private String weather;

    public WeatherDateC() {
        list= new ArrayList<>();
    }

    public void register(ObserverC observerC) {
        list.add(observerC);
    }

    public void setDate(String weather) {
        this.weather=weather;
        notifyAllObserver();
    }

    private void notifyAllObserver() {
        for (ObserverC observerC : list) {
            observerC.update(weather);
        }
    }
}
